There are always a variety of ways to get the version of Microsoft SQL Server (MSSQL). The easiest way to get the version is to use MSSQL Enterprise Manager (or SQL Server Studio) and view the version number next to the server name.
There is another way by examing the value of the @@version variable. Specifically you can execute the following SQL statements:
The following code will as well, and in a slightly different format:
SELECT 'SQL Server ' + CAST(SERVERPROPERTY('productversion') AS VARCHAR) + ' - ' + CAST(SERVERPROPERTY('productlevel') AS VARCHAR) + ' (' + CAST(SERVERPROPERTY('edition') AS VARCHAR) + ')'
This will return the data in a slightly different format so you can identify the information related to which type of SQL Server is installed.
But many people will wonder why you'd even want to execute the SQL since it would take longer. My thought is that if you wrapped this up in a CMD file (using OSQL to execute it against a list of servers) you can generate a list of the versions of MSSQL that exist in your environment. This makes it easier for audit questions or if you just need to validate what versions you are using.