This may be of some use to inexperienced researchers who have had problems locating distant ancestors. It's only in recent times that spelling has been regularised, and sometimes your forebears may be present in the records but "hiding" under a surname spelling you never thought of.
Sometimes local pronunciations may be a guide. Certainly, in Fife, the pronunciation of a name by local people may be nothing like its official spelling. In my native corner of the East Neuk, for example, the name Corstorphine has usually been pronounced Strauchan. Nothing to do with the completely separate name of Strachan!
And Cunningham, in my home town of Cellardyke, was always pronounced Kinny. My granny Jessie Cunningham was known as "Jess Kinny". My mother, a native of Crail, just 4 miles to the east, told me once that the Cunninghams there were known as Kinnins.
That proved useful recently when I was trying to help a correspondent to trace her Cunningham ancestors in the parish of Ceres. We got back to William Cunningham who married Jane or Jean Colville in 1806, but who were his parents? I finally worked out that they were William "Cunnings" and Euphan Gourlay, who were married at Ceres in 1773. A bit more research turned up their children, Thomas(1774), David(1775), Agnes(1777), all registered as Cunnins or Cunnings, then John and Christian, twins (1781), Andrew(1783) and another John(1785), all registered as Cunningham!
What has happened, I think, is that a new clerk or minister has decided that the old spelling Cunnin(g)s is rather uncouth, and they've substituted the more acceptable Cunningham.
So don't despair if you can't find your distant ancestors under the modern spelling of the name. Try the Fuzzy Matching option on Scotlandspeople, and if you happen to know that there is an alternative local pronunciation of the name, try looking under that spelling.
Harry