Recently a few of developers started complaining about 100s of database in one instance, making them difficult to navigate in SSMS. This situation is quite generic in all development environment. So here we are going to do a little trick to hide all the databases in SSMS and show only the ones that are given access to the users.
DO NOT TRY THIS ON PRODUCTION.
--Hide all databases to public. All databases are still visible to sysadmins USE master; GO DENY VIEW ANY DATABASE TO PUBLIC;
--Making the user as db owner to give exclusive access on the database use DBName GO exec sp_changedbowner [dbuserone]