The melody given in the Mudcat database is incorrect. In John Greig's Scots Minstrelsie, Vol. 1, the melodie to Jock o' Hazeldean is given as ' ..an old air, "Willie and Annet", embellished ...'
It is written in E major and the highest note, Eb begins lines 1, 2, and 4, as Jack Campin said.