IF Exists(SELECT * FROM sys.indexes 
WHERE name='IX_ArrangementReservationsXtab' AND object_id = OBJECT_ID('dbo.ArrangementReservationsXtab'))
	DROP INDEX IX_ArrangementReservationsXtab ON dbo.ArrangementReservationsXtab
IF Exists(SELECT * FROM sys.indexes 
WHERE name='IX_ArrangementReservationsXtab_1' AND object_id = OBJECT_ID('dbo.ArrangementReservationsXtab'))
	DROP INDEX IX_ArrangementReservationsXtab_1 ON dbo.ArrangementReservationsXtab
IF Exists(SELECT * FROM sys.indexes WHERE name='IX_ArrangementReservationsXtabGuestNumber' AND object_id = OBJECT_ID('dbo.ArrangementReservationsXtab'))
	DROP INDEX IX_ArrangementReservationsXtabGuestNumber ON dbo.ArrangementReservationsXtab

IF NOT EXISTS (SELECT * FROM sys.indexes WHERE name='IX_ArrangementReservationsXtab_ReferenceNumber' AND object_id = OBJECT_ID('dbo.ArrangementReservationsXtab'))
  CREATE NONCLUSTERED INDEX [IX_ArrangementReservationsXtab_ReferenceNumber] ON [dbo].[ArrangementReservationsXtab] ([Referencenumber])
GO
