Run a query in loop, with the results of another query
If you want to assemble the statement at runtime, you're locked into Dynamic SQL as far as I know.  I don't like sp_MSforeachdb as well because it's undocumented and I've ran into bugs with it, so here's an alternative that doesn't require its use:

DECLARE @cmd nvarchar(max) = N'';

SELECT @cmd = @cmd + N'
UNION ALL

SELECT ' + QUOTENAME(QUOTENAME(name),N'''') + N' AS Database_Name
, o.name AS Table_Name
, i.name AS Index_Name
, i.type_desc AS Index_Type
FROM sys.indexes i
INNER JOIN ' + QUOTENAME(name) + '.sys.objects o ON i.object_id = o.object_id
INNER JOIN ' + QUOTENAME(name) + '.sys.schemas sc ON o.schema_id =     sc.schema_id
WHERE i.name IS NOT NULL
AND o.type = ''U'''
FROM sys.databases
WHERE database_id &gt; 4  -- comment out if you want to include system databses

SELECT @cmd = STUFF(@cmd, 1, 13, N'') + N' ORDER BY 1, 2'

PRINT @cmd

EXEC sp_executesql @cmd;