create table #SqlEhr(sqlEx varchar(max), id int IDENTITY(1, 1))

insert INTO #SqlEhr(sqlEx)
SELECT 
    DISTINCT 'CREATE NONCLUSTERED INDEX [IX_' + OBJECT_SCHEMA_NAME(i.object_id) + '.' + OBJECT_NAME(ic.object_id) + '_EhrRusRefBooks] ON ' + OBJECT_SCHEMA_NAME(i.object_id) + '.' + OBJECT_NAME(ic.object_id) + ' (EhrRusRefBooks) WITH (SORT_IN_TEMPDB = ON)'
FROM 
    SYS.indexes AS i
JOIN 
    SYS.index_columns AS ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
JOIN 
    SYS.columns AS c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
WHERE 
    c.name <> 'EhrRusRefBooks'
    AND OBJECT_SCHEMA_NAME(i.object_id) = 'EHR'
	AND EXISTS(SELECT 1 FROM SYS.columns COL WHERE COL.object_id = I.object_id AND COL.name = 'EhrRusRefBooks')
	AND NOT EXISTS(
		SELECT 1 
		FROM SYS.index_columns IC2 
			JOIN SYS.columns C2 ON ic2.object_id = c2.object_id AND ic2.column_id = c2.column_id
		WHERE 
			i.object_id = ic2.object_id
			AND c2.name = 'EhrRusRefBooks')

DECLARE @SQL VARCHAR(MAX)=''
DECLARE curs CURSOR FOR
	SELECT sqlEx
	FROM #SqlEhr
	order by Id

OPEN curs
FETCH NEXT FROM curs INTO @SQL
WHILE @@FETCH_STATUS = 0
BEGIN
	exec (@sql)
	FETCH NEXT FROM curs INTO @SQL
END
CLOSE curs
DEALLOCATE curs

drop table #SqlEhr