if exists (select * FROM sys.sysobjects where id = object_id(N'dbo.Department')) and not exists (select * FROM sys.sysobjects where id = object_id(N'dbo.Repository'))
begin
    exec sys.sp_rename 'dbo.Department', 'Repository';
    exec sys.sp_rename 'dbo.DF_Department_CreationDate', 'DF_Repository_CreationDate';
    exec sys.sp_rename 'dbo.DF_Department_ModifiedDate', 'DF_Repository_ModifiedDate';
    exec sys.sp_rename 'dbo.PK_Department', 'PK_Repository';
end