Alternate solution for the above question by using single global variable of SQL Server is as follows:
SELECT @@VERSION
OUTPUT:
Microsoft SQL Server 2008 R2 (RTM) -
10.50.1600.1 (Intel X86) Apr 2 2010 15:53:02 Copyright (c) Microsoft Corporation
Developer Edition on Windows NT 6.1 <X86> (Build 7601: Service Pack 1)
Bold part is Product level
Underlined part is Product version
Hyperlinked part is edition