How to Identify Your SQL Server Service Pack Version and Edition with SQL Script

Open SQL Server Management Studio or Microsoft Query Analyzer (MSSQL) and enter the following command in a empty query window.

SELECT  rtrim(convert(varchar(15), SERVERPROPERTY('productversion'))) 'Product-Version',
rtrim(convert(varchar(10), SERVERPROPERTY ('productlevel'))) 'Product-Level(SP#)',
rtrim(convert(varchar(50), SERVERPROPERTY ('edition'))) 'Edition'

SELECT  convert(varchar(50), SERVERPROPERTY('productversion')),
convert(varchar(10), SERVERPROPERTY ('productlevel')),
convert(varchar(50), SERVERPROPERTY ('edition'))

The convert and the rtrim function is used only make readable.