-- Check to see that the object names are local to the current database. fetch ms_crs_ind into @indid, @type, @groupid, @indname, @ignore_dup_key, @is_unique, @is_hypothetical, @is_primary_key, ...
IF NOT EXISTS(SELECT 1 FROM sys.indexes WHERE name = 'IX_CreationTime' AND object_id = OBJECT_ID('[dbo].[QueueItems]')) -- Get Cutoff Id of Jobs, QueueItems ...