Remember that even if MOSS is installed on the server, it is quite possible that for sites / site collections on which your code should work, only WSS functions are activated. Thus, an alternative way is to check if certain MOSS functions are available on the server, and maybe even check if they have been activated. A good candidate would be the publishing feature, which only comes with MOSS.
source
share