IF NOT Exists(SELECT * FROM sysindexes SI INNER JOIN sysobjects SO ON SO.[id] = SI.[id] AND so.[name] = 'diary' WHERE SI.[name] = 'KeyEmailDates') BEGIN CREATE NONCLUSTERED INDEX [KeyEmailDates] ON [dbo].[diary] ([EMAIL] ASC, [TxmDate] ASC, [DATE] ASC) ON [PRIMARY] END GO