DECLARE @tpl VARCHAR(255)='exec msdb.dbo.sp_start_job @job_name= ''@job@''; '+CHAR(13)+CHAR(10)
DECLARE @q VARCHAR(MAX)='';

SELECT @q = @q + REPLACE(@tpl, '@job@', j.name)
FROM msdb.dbo.sysjobs j
WHERE name LIKE 'ActivePosTran distribution agent -%'
AND NOT EXISTS(
	--the job is currently running
	SELECT 1
	FROM msdb.dbo.sysjobactivity sja
	WHERE sja.job_id = j.job_id
	AND sja.start_execution_date IS NOT NULL 
	AND sja.stop_execution_date IS NULL
)

IF @q <> ''
BEGIN
	PRINT @q
	EXEC(@q)
END
