IF NOT EXISTS (SELECT * FROM sys.tables t 
               JOIN sys.schemas s ON t.schema_id = s.schema_id 
               WHERE s.name = 'EHR' AND t.name = 'T_EHR_RUS_69K8FB73EO')
BEGIN

    -- Tables

/***** Object:  Table [EHR].[T_EHR_RUS_69K8FB73EO] *****/
CREATE TABLE [EHR].[T_EHR_RUS_69K8FB73EO]
(
    [EhrRusID] int NOT NULL,
    [IdEHR] int NULL,
    [NameEHR] varchar(2048) NULL,
    [REQUEST] int NULL,
    [CONSULTATION] int NULL,
    [CONSULTANT] int NULL,
    [DOCTOR] int NULL,
    [DATEOUT] datetime NULL,
    [EhrRusRefBooks] int NOT NULL
)
ON [PRIMARY]

-- Alters

ALTER TABLE [EHR].[T_EHR_RUS_69K8FB73EO] ADD CONSTRAINT [PK_T_EHR_RUS_69K8FB73EO]
PRIMARY KEY CLUSTERED ([EhrRusID]) ON [PRIMARY]

ALTER TABLE [EHR].[T_EHR_RUS_69K8FB73EO] ADD CONSTRAINT [FK_T_EHR_RUS_REF_BOOKS_T_EHR_RUS_69K8FB73EO_EhrRusRefBooks]
FOREIGN KEY([EhrRusRefBooks]) REFERENCES [EHR].[T_EHR_RUS_REF_BOOKS] ([EhrRusRefBooksID])

END
GO