sql script to get the list of database on the server code example
Example 1: show databases in sql server
SELECT * FROM SYS.SYSDATABASES
Example 2: show databases in sql server
EXEC SP_DATABASES
SELECT * FROM SYS.SYSDATABASES
EXEC SP_DATABASES