SQL Server Version

SET NOCOUNT ON;
GO

DECLARE @SQL_Version AS numeric(4,1);

SELECT @SQL_Version = LEFT(CAST(SERVERPROPERTY('productversion') AS varchar), 4);

SELECT CASE @SQL_Version
  WHEN 9    THEN '2005'
  WHEN 10   THEN '2008'
  WHEN 10.5 THEN '2008R2'
  WHEN 11   THEN '2012'
  WHEN 12   THEN '2014'
  WHEN 13   THEN '2016'
END AS 'SQL Version';
GO

SET NOCOUNT OFF;
GO