if not exists (SELECT * FROM sys.indexes WHERE name = 'IX_DepartmentHistory_DepartmentID' AND object_id = OBJECT_ID('dbo.DepartmentHistory'))
    create index IX_DepartmentHistory_DepartmentID on dbo.DepartmentHistory (DepartmentID)