Thank you for reply.
For one of the database (lets call it XPTO) in the instance I get results for the other ones I don't.
I simplify the query for this one bellow
select sdes.*
, sdec.*
, sdest.*
FROM sys.dm_exec_sessions AS sdes
INNER JOIN sys.dm_exec_connections AS sdec ON sdec.session_id = sdes.session_id
cross apply ( SELECT DB_NAME(dbid) AS DatabaseName FROM sys.dm_exec_sql_text(sdec.most_recent_sql_handle) ) sdest;
The field Databasename just shows data for the database XPTO and for the master and msdb.
For the other databases in the instance gives the value NULL
João