if not exists(select * from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_MEDICAL_RECORD', 'U') and i.name = 'IX_MEDICAL_RECORD_MedicalEpisode')
    CREATE INDEX [IX_MEDICAL_RECORD_MedicalEpisode] ON [AKUZ].[T_MEDICAL_RECORD] ( MedicalEpisode ) WHERE MedicalEpisode IS NOT NULL WITH (FILLFACTOR = 90, MAXDOP = 0,SORT_IN_TEMPDB = ON);
go