Count the total number of databases
SELECT * FROM sys.databases
OR
SELECT COUNT(*) FROM sys.databases
try select COUNT(*) from sysdatabases
or select COUNT(*) from sys.databases
edited from source: http://www.sqlservercentral.com/Forums/Topic401516-463-1.aspx#bm816566
You can try this
SELECT Count(*) as DatabaseCount FROM master..sysdatabases
or
SELECT count(*) as DatabaseCount FROM master.sys.databases