Este Script identificar os usuários que estão conectados na instância do SQL Server.
SELECT
session_id,
login_time,
host_name,
program_name,
client_interface_name,
login_name,
status,
cpu_time,
memory_usage,
last_request_start_time,
last_request_end_time,
transaction_isolation_level,
lock_timeout,
deadlock_priority
FROM
sys.dm_exec_sessions
WHERE
login_name NOT IN (‘sa’, ‘AUTORIDADE NT\SISTEMA’, ‘NT AUTHORITY\SYSTEM’)