Declare icursor cursor
for
select name from sysobjects where xType = 'U' and left(name,1) = 'k'
open icursor
fetch next from icursor into @Name
while (@@fetch_status=0)
begin
set @strSql = 'CREATE CLUSTERED INDEX index_'+@Name+' ON '+@Name+' ([UserID] ASC,[CourseID] ASC) ON [PRIMARY]'
exec(@strSql)
set @strSql = ''
fetch next from icursor into @Name
end