You may be interested in my answer to a similar question from a few years ago, which can be found here: When did Scottish people start speaking English?, as well as the answers provided by u/Yourmemoriesonsale to When did English become the dominant language of Scotland? and by u/MoragLarsson to Why and when did Scots start speaking English and abandoned Gaelic?. I think these three threads will serve as a good primer on this issue and would highly recommend checking out the following for a more in-depth examination of Scotland's linguistic history:
Aitken, A.J. and Tom McArthur, eds., Languages of Scotland. Edinburgh: W and R Chambers, 1979.
Murison, David Donald. "Linguistic Relationships in Medieval Scotland," in The Scottish Tradition: Essays in Honour of Ronald Gordon Cant. Edited by G.W.S. Barrow. Edinburgh: Scottish Academic Press, 1974.
Withers, Charles W.J."‘A Geography of Language: Gaelic-Speaking in Perthshire, 1689-1879", Transactions of the Institute of British Geographers, 8 no. 2 (1983): 125-42.
Withers, Charles W.J., Gaelic in Scotland, 1698-1981: the Geographical History of a Language. Edinburgh: John Donald, 1984.
Hope this helps!