"Did you ever think when the hearse goes by That you might be the next to die?.... The worms crawl in, the worms crawl out, The worms play pinochle on your snout...." A detailed description of how corruption attacks a body in a grave
The Pankakes report that this has been attributed to the Crimean War. They do not cite a source for this information.
The key line, "The worms crawl out, the worms crawl in" appears as part of "Skin and Bones (The Skin and Bones Lady)" in the revised 1810 edition of _Gammer Gurton's Garland_, but it may have been an editorial insertion.
A similar lyric is found in the ballad of "Alonzo the Brave and Fair Imogene," but I don't know if that's a case of cross-dependence (let alone which way the dependence goes) or an independent evolution.
Charles Clay Doyle published a study of this, "'As the Hearse Goes By': The Modern Child's _Memento Mori_,' in Francis Edward Abernathy, ed., _What's Going On? (In Modern Texas Folklore)_ (1976; the Doyle essay begins on p. 175). This documents the widespread nature of the song (without giving really detailed statistics about its distribution). It also compares it with a Middle English tradition of songs about bodily decay -- a comparison I find rather a stretch. - RBW