How to aggregate the number of indexes on a table and columns per index
If you want a stable, reliable, and free script, try sp_BlitzIndex. As a disclaimer, it's part of an open source project I contribute to.

If you run it like so, it will go through all the databases on your server and produce the information you asked for, plus a lot of other nice details.

EXEC sp_BlitzIndex @GetAllDatabases = 1, @Mode = 2;