HAS_DBACCESS returns information about whether the user has access to the specified database.
1 if the user has access to the database
0 if the user does not have access to the database
NULL if the database does not exist
Find all databases that the current user has access to
SELECT [Name] as DatabaseName
ORDER BY [Name]