You never know when you will need to get all the jobs steps in a hurry. This is a great script for this situation.
Someday you might need to see the steps of any specific job or find in which step of which job does a specific query is used. Confused!
Following query will show you all the steps of a specific job having a specific query in any of its steps.
SELECT JOB.NAME AS JOB_NAME,
STEP.STEP_ID AS STEP_NUMBER,
STEP.STEP_NAME AS STEP_NAME,
STEP.COMMAND AS STEP_QUERY,
FROM Msdb.dbo.SysJobs JOB
INNER JOIN Msdb.dbo.SysJobSteps STEP ON STEP.Job_Id = JOB.Job_Id
WHERE JOB.Enabled = 1
AND (JOB.Name = ‘%Job_Name%’ OR STEP.COMMAND LIKE ‘%Exec AnotherStoredProcedure%’)
ORDER BY JOB.NAME, STEP.STEP_ID