Is there a word for the decoration on top of a building?

You could use the word finial.

A distinctive section or ornament at the apex of a roof, canopy, etc. on a building:
curving gables topped by sculptured finials

[ODO]