I am converting over some code from SQL Server 2000 to SQL Server 2005 and I am having some problems with the sp_addlogin calls that I make in SQL Server 2000. The CREATE LOGIN command is the preferred call for SQL Server 2005. I was thinking of checking the sql version in my code to determine what sql version is running and call sp_addlogin for SQL Server 2000 and CREATE LOGIN for SQL Server 2005. I was thinking of doing this so that I can maintain one source code. My question is, should I use Select DATABASEPROPERTYEX('master', 'version') to determine the version? I know that for SQL 2005 this returns 611 and 539 for SQL Server 2000. Would these numbers change if for example some service packs were installed? Is there a better way of checking the version? Thanks in advance.