Mr Whiteside will replace Greggs's current chief executive, Ken McMeikan. The Scot last month revealed he is leaving to run catering supply giant Brakes.
Newcastle-based Greggs has more than 230 outlets in Scotland, employing 2800 people.
Meanwhile, Punch Taverns, which remains mired in talks with investors on restructuring its £2 billion debt pile, said chairman Stephen Billingham will take on executive duties.
Property and turnaround director Neil Griffiths has been appointed chief operating officer.
The chain, Scotland's biggest landlord with around 280 outlets in the country, said "a new chief executive officer will not be appointed at this time".
Mark Brumby, analyst at Langton Capital, wrote in a note for clients: "It is not easy to see how the departure of the CEO (and his non-replacement) could be interpreted as a good thing."
Greggs's shares rose 5p to 480p. Punch's fell 0.375p to 10.88p.
Mr Whiteside, who has been a non-executive director of Greggs since 2008, will take up his new role on February 4. Mr McMeikan will leave the company on March 8.
Greggs chairman Derek Netherton said: "We are delighted to announce the appointment of Roger as chief executive. Not only has he got considerable management experience in retailing and food but also, as a non-executive director of Greggs during a period of significant change, he has been involved in developing the strategy."
Mr Whiteside has been chief executive of Punch since 2007 after a career that has taken him through Marks & Spencer and the founding team of internet shopping business Ocado. From 2004 to 2007, he was chief executive of off-licence chain Thresher Group.
Sanjay Vidyarthi, analyst at Espirito Santo, said: "Our view is that Greggs is facing challenges on the high street, in part macro and in part a function of the general trend of declining footfall.
"Strategies in place to address this (new formats, refurbs, product range improvement, marketing, etc) are sound, in our view. We do not think that radical change is required, though the pace may need to accelerate."
Punch said it is trading in line with the board's expectations and it will make an announcement about its capital structure "in due course".