The number of people working in Scotland’s civil service and public bodies has surged in recent years, figures have shown