This will work fine, but there is a simpler way, you can check current tds version, if version is 7.3 and higher this means server is 2008 or higher
http://msdn.microsoft.com/en-us/library/135d0ebe-5c4c-4a94-99bf-1811eccb9f4a#id8