I have Hoggs in my own tree so thought I would give you some variants I've encountered on census & other sources.......
Hagg, Hogge, Ogg, Og
Need to be a wee bit careful with these variants. G F Black's
The Surnames of Scotland says
"Hogg, Hogge. This surname is usually explained as a nickname derived from the name of the animal .... there are other undoubted instances pointing to different origins .... The spelling .... Hoga .... certainly points to O[ld] E[nglish
hoga 'careful', 'prudent', as origin of the name at least in this instance .... Hogge 1656, Hogh 1496, Hoig 1515, Hoige 1526, Hogis 1519, Howg 1686". (I am sure that I have also read somewhere that it is from the Norse given name 'Haug' but Black says nothing about that.)
"Ogg, Oag. Both these names are from the Gaelic adjective
og, "young" .... Oage 1688."
In other words, these names are not necessarily interchangeable.
Maybe William was a Gaelic-speaking Ogg from the Highlands, and when he moved to the Lowlands got recorded as Hogg because that surname is commonest in the Borders and Lowlands.