if not exists(select * from sys.sysobjects where id = object_id(N'dbo.InventoryScanADDomain'))
begin
    create table dbo.InventoryScanADDomain (
        ScanID uniqueidentifier not null constraint FK_InventoryScanADDomain_ScanID foreign key references dbo.InventoryScan(ID),
        ADDomainID uniqueidentifier not null constraint FK_InventoryScanADDomain_ADDomainID foreign key references dbo.InventoryADDomain(ID),
        constraint PK_InventoryScanADDomain primary key clustered (ScanID, ADDomainID)
    );
end;