use EnVisage

begin tran
	if exists (select 1 from sys.indexes where sys.indexes.object_id = OBJECT_ID('PeopleResource') and name = 'IX_PeopleResource_1')
	begin
		drop index IX_PeopleResource_1 on PeopleResource
	end

	if exists (select 1 from sys.foreign_keys where sys.foreign_keys.parent_object_id = OBJECT_ID('PeopleResource') and name = 'FK_Resource_Team')
	begin
		alter table PeopleResource
		drop constraint FK_Resource_Team
	end

	if exists (select 1 from sys.columns where sys.columns.object_id = OBJECT_ID('PeopleResource') and name = 'TeamId')
	begin
		alter table PeopleResource
			drop column TeamId
	end
commit tran