SQLServer Connection Monitor

SELECT T1.session_id AS [SessionId]
  
, T1.host_process_id AS [HostPid]
  
, DB_NAME(T3.dbid) AS [Database]
  
, T1.HOST_NAME AS [Host]
  
, T1.program_name AS [ApplicationName]

   T1.login_name AS [UserName]
  
, T2.client_net_address AS [IP]
  
, T1.cpu_time AS [Cpu]
  
, T1.memory_usage AS [Ram]
  
, T4.Connections AS [Connections]
  
, T4.net_transport AS [NetTransport]
  
, T2.net_packet_size AS [NetPacketSize]
  
, '[' + DB_NAME(T3.dbid) + '].['
    
+ object_schema_name(T3.objectid, T3.dbid) + '].['
    
+ OBJECT_NAME(T3.objectid, T3.dbid) + ']' AS [ObjectName]
  
, T3.TEXT AS [Query]

FROM sys.dm_exec_sessions T1
INNER JOIN sys.dm_exec_connections T2 ON T2.session_id = T1.session_id
CROSS APPLY sys.dm_exec_sql_text(T2.most_recent_sql_handle) T3
INNER JOIN
(
  
SELECT T1.dbid, T1.spid, T2.net_transport, COUNT(T1.dbid) AS [Connections]
  
FROM sys.sysprocesses T1
  
INNER JOIN sys.dm_exec_connections T2 ON T1.spid = T2.session_id
  
GROUP BY dbid, T1.spid, T2.net_transport

) T4 ON T4.spid = T1.session_id
ORDER BY Connections DESC, Cpu DESC, Ram DESC