This feature has been disabled in Visual Studio Community 2017, although it sounds like it was temporarily available in pre-release versions.
The Visual Studio Team issued this statement on the 14th of March 2017:
An authoring error in the SQL Server Data Tools resulted in the capability temporarily showing up incorrectly in Visual Studio Community when installed; the change you see is a result of correcting that mistake.
Also, on the Compare Visual Studio 2017 Offerings page CodeLens appears to not be available in the Community edition.