title: SQL - How to find currently running job steps through TSQL
body: <p>I am writing a query to find currently running job in SQL (I know we can view it in Job Active Monitor, but I've a need to do in TSQL). Though I can query sysjobactivity table to find currently running job, it's nowhere telling what job step is running (because my job might have more than 1 step).</p>
  
  <p>Query I used:</p>
  
  <pre><code>SELECT s.name AS [JOB_NAME],
         '' AS [STEP_ID], 
         '' AS STEP_NAME, 
         'Processing' AS STATUS, 
         sja.run_requested_date AS START_TIME, 
         null AS END_DATE,
         convert(varchar, (getdate() - sja.run_requested_date), 8) AS Duration 
    FROM sysjobactivity sja, sysjobs s
   WHERE sja.job_id = s.job_id
     AND sja.run_requested_date &gt;  getdate() - 1
     AND sja.stop_execution_date IS NULL
  </code></pre>
  
  <p>Please help me finding the step ID &amp; Step name in which the job is currently progressing.</p>