Trying to filter msdb..sysjobs by job_id
Stop using CAST and use CONVERT. Specifically because, in this case, you need to use a certain style parameter in order to get the right string comparison (otherwise it is just converting 0xwhatever to the string value represented by 0xwhatever, which is not 0xwhatever. Compare:

SELECT 
  CONVERT(VARCHAR(32), 0x48656C6C6F21),
  CONVERT(VARCHAR(32), 0x48656C6C6F21, 1);
  ----- only difference -------------^^^


Results:

------   --------------
Hello!   0x48656C6C6F21


Hello! is actually the string represented by the binary value. The second column is just the binary value displayed as a string. Big difference!

With that in mind, change the join criteria on your last query to:

INNER JOIN msdb.dbo.sysjobsteps sj -- why leave out dbo?
  ON SUBSTRING(s.[program_name],30,34) = -- prefix your columns
  CONVERT(VARCHAR(34), CONVERT(VARBINARY(32), sj.job_id), 1) -- no need for MAX types here
  ------- this is the important piece ------------------^^^