-- If you know both the job name and schedule name
DECLARE @JobName NVARCHAR(100) = 'PROD_MONTHLY_DTSCHGDC';
DECLARE @ScheduleName NVARCHAR(200) = 'PROD_MONTHLY_DTSCHGDC_MonthlySchedule';
DECLARE @JobId UNIQUEIDENTIFIER;

-- Get job ID
SELECT @JobId = job_id FROM msdb.dbo.sysjobs WHERE name = @JobName;

-- Detach from specific job
EXEC msdb.dbo.sp_detach_schedule @job_id = @JobId, @schedule_name = @ScheduleName;

-- Then delete
EXEC msdb.dbo.sp_delete_schedule @schedule_name = @ScheduleName;
