As a child I learned a similar version, but we sang it to the "Over the Hills" tune.
Tom he was a piper's son,
Learned to play when he was young.
But all the tunes that he could play
Was 'Over the hills and far away'.
Over the hills and a great way off,
The wind shall blow my topknot off.