You can retrieve information about the number of connected users to a SQL Server. It is also possible to check which users are connected to a particular database.
Few examples in below:
Example 1: To check all users and process connection
select @@servername as server, count(distinct usr) as users, count(*) as processes from
( select sp.loginame as usr, sd.name as db
from sysprocesses sp join sysdatabases sd on sp.dbid = sd.dbid ) as db_usage
Example 2: To check individual users and process connection
select Users, count(distinct db) as Databases, count(*) as processes from
( select sp.loginame as Users, sd.name as db
from sysprocesses sp join sysdatabases sd on sp.dbid = sd.dbid ) as db_usage
group by Users
order by Users
Example 3: To check database, user and process connections
select db, users, count(*) as processes from
( select sp.loginame as users, sd.name as db
from sysprocesses sp join sysdatabases sd on sp.dbid = sd.dbid ) as db_usage
where db like('%')
group by db, users
order by db, users