if exists (select * from sys.foreign_keys where object_id = OBJECT_ID(N'FK_ConnectionState_ConnectionID') AND parent_object_id = OBJECT_ID(N'dbo.ConnectionState'))
    alter table dbo.ConnectionState drop constraint FK_ConnectionState_ConnectionID