if not exists (select * from sys.sysobjects where id = object_id(N'dbo.PamCheckout'))
begin
    create table dbo.PamCheckout (
        ID uniqueidentifier NOT NULL,
        CredentialID uniqueidentifier NOT NULL constraint FK_PamCheckout_CredentialID foreign key references dbo.PamCredential(ID),
        UserID uniqueidentifier NULL constraint FK_PamCheckout_UserID foreign key references dbo.UserAccount(ID) on delete set null,
        Reason nvarchar(max) NULL,
        Status int NOT NULL,
        Duration int NOT NULL,
        RequestDateTime datetime2 NULL,
        CheckoutDateTime datetime2 NULL,
        CheckinDateTime datetime2 NULL,
        constraint PK_PamCheckout primary key clustered (ID)
    );
end;