if (select a.run_duration from msdb.dbo.sysjobhistory a join msdb.dbo.sysjobs b on a.job_id= b.job_id where b.name like ‘test’ and a.step_id =1 and
a.run_date >= cast (convert( varchar(10),getdate(),112) as int) ) > 1200
exec dbo.sp_stop_job ‘test’
else
print ‘The job is not currently running’