if exists (select * FROM sys.sysobjects where id = object_id(N'dbo.ConnectionWikiHistory'))
begin
    if not exists (select * FROM sys.sysobjects where id = object_id(N'dbo.ConnectionHandbookHistory'))
	    exec sp_rename N'dbo.ConnectionWikiHistory', N'ConnectionHandbookHistory'; 
    else
	    drop table dbo.ConnectionWikiHistory; 
end