if not exists (SELECT * FROM sys.indexes WHERE name = 'IX_UserInfoHistory_UserInfoID' AND object_id = OBJECT_ID('dbo.UserInfoHistory'))
    create index IX_UserInfoHistory_UserInfoID on dbo.UserInfoHistory (UserInfoID)