Most health boards are short of paediatric doctors and some say they have advertised posts repeatedly but failed to attract suitable applicants.
Figures show even the prestigious Royal Hospital for Sick Children at Yorkhill in Glasgow has had one consultant vacancy since March 2011 and another since last July.
However, it is district general hospitals that are worst affected. One official at the Royal College of Paediatrics and Child Health (RCPCH) warned of a "national crisis in terms of paediatric staff".
The shortage of middle-grade doctors, who are vital for looking after young patients at night, is a particular concern.
Data given under Freedom of Information revealed that Dumfries and Galloway Royal Infirmary is running with almost as few as one-third of the middle-grade paediatric doctors required.
At Borders General Hospital, two middle-grade posts have been empty for two years.
In Fife, there should be 10 middle-grade doctors filling rotas but only 7.6 are in post and in NHS Forth Valley there is only half the required number of middle-grade staff.
A spokesman for NHS Forth Valley said: "Although the posts have been advertised on more than one occasion we have been unable to recruit replacements."
Staffing gaps are currently being filled by locums, or sometimes by consultants working through the night, even though they also have to work during the day.
Dr Andrew Eccelston, who in addition to his role with the RCPCH is a consultant paediatrician in an NHS hospital, said: "There is a national crisis in terms of paediatric staff. The danger with the locum solution is it is not a particularly robust long-term solution because these are not our doctors.
"They choose to come to do shifts with us to earn extra money and there is no guarantee they will be available next week or next month. If they are not available the risk is that consultants have to fill the gap.
"If you have not got a doctor to fill a slot on a rota you have only got two options. Either you close your service or you bring in the consultants."
Last summer, the children's ward at St John's Hospital in Livingston was shut for three weeks due to a short-term staffing crisis and 35 children had to be sent to the Royal Hospital for Sick Children in Edinburgh.
Dr Eccleston warned there were several other hospitals in Scotland that could end up in the same position. He said: "The risk is that on occasion we are sailing so close to the limit of our resources that we might reach a position where we cannot keep the service running."
In more remote areas, this could mean children with life-threatening illnesses such as meningitis or severe asthma attacks having to travel much further for treatment. Dr Eccleston added: "You do not really want these children to be having to be transferred somewhere else for treatment, not over any kind of distance."
He added that the sudden closure of a service would also put pressure on the receiving hospital and reduce ambulance cover as paramedics took children further from home.
The shortage of paediatric specialists has arisen because of a number of factors, according to the college, including growing numbers of female doctors requesting maternity leave and part-time working.
Other factors include European legislation restricting working hours, a reduction in the number of training jobs available
and, crucially, new immigration rules preventing the recruitment of medical staff from outside the European Union.
Dr Graeme Eunson, a consultant paediatrician and member of the Scottish Council of the British Medical Association, said: "At present there are an awful lot of short-term fixes – people working beyond their normal hours, people being drafted in to do additional shifts here, there and everywhere.
"That can work up to a certain point, but there does need to be an increase in the paediatric consultant workforce."
He added that there were also other solutions, such as training nurses to become advance practitioners taking on medical work, but this took time, money and willingness among staff.
A Scottish Government spokesman said: "It is the responsibility of NHS boards to plan and deliver clinical services – including paediatrics.
"In preparing their workforce plans, boards are required to consider relevant local issues and demographic changes and assess the resultant demands and implications for service delivery."