SQL Agent job session

Shows the SQL Server session being used to execute a SQL Agent job.

SELECT
  j.job_id
, s.session_id
, j.name
FROM sys.dm_exec_sessions s
  INNER JOIN msdb.dbo.sysjobs j ON j.job_id =
    CONVERT(
      UNIQUEIDENTIFIER
    , CONVERT(VARBINARY(36), SUBSTRING(s.[program_name], 30, 34), 1)
    )
WHERE s.[program_name] like 'SQLAgent - TSQL JobStep (Job %'