declare @objectID int;
select @objectID = object_id from sys.triggers where parent_id = object_id(N'dbo.UserAccount') and name= N'trUserAccount_Update';
declare @createOrAlter nvarchar(6);
set @createOrAlter = case when @objectID is null then N'create' else N'alter' end;
exec (@createOrAlter + N' trigger dbo.trUserAccount_Update
on dbo.UserAccount after update
as
begin
    set nocount on;

    if (update (SecurityKey))
    begin
        update dbo.DatabaseInfo set ConnectionCacheID = newid(), IntelligentCacheID = newid();
    end
end;');