DECLARE @RegLoc VARCHAR(100)
select @RegLoc='SOFTWARE\Microsoft\Windows NT\CurrentVersion'
EXEC [master].[dbo].[xp_regread] @rootkey='HKEY_LOCAL_MACHINE',
@key=@RegLoc,
@value_name='ProductName'
The above code will return the installed version of windows on which the current instance of Sql Server is running.
references:
http://www.mssqlcity.com/Articles/Undoc/UndocExtSP.htm