Plans to ban schools from serving junk food and sugary drinks have been put forward by the Scottish Executive.
School dinners will have to be healthier under new rules
The move comes after figures showed one in every three children moving from primary to secondary school in Scotland was overweight.
Ministers said the new approach would also affect school vending machines, breakfast clubs and tuck shops.
The news came as two reports said the executive had failed to meet a number of targets to improve Scotland's diet.
Studies by the Food Standards Agency and an independent experts panel found that in some areas Scots were eating even more of the wrong types of food than 10 years ago.
The bill comes in the wake of new guidelines for schools in England which state that all meals must contain at least two portions of fruit and vegetables, while deep-fried foods are to be restricted.
The restrictions there also apply to school vending machines.
In Scotland, the bill aims to ensure that food and drink served in schools meets strict nutritional standards and reducing the stigma associated with free school meals by requiring councils to protect the identity of eligible pupils.
Education Minister Peter Peacock said: "We are determined to overturn Scotland's tag as the sick man of Europe and we are taking action to make sure this happens.
It is hoped snacks like fruit and yogurt will take over from junk
"This bill will help improve the health of our youngsters. It will make the healthy choices the easy choices while they are in school and it will ensure they are aware of the dangers of eating unhealthy food.
"Promoting the uptake of school meals and anonymising free school meals should mean more pupils will benefit from the healthier meals and snacks being served in Scottish schools."
Councils are being given the power to provide free snacks and breakfasts, preparing the way for the return of free milk or fruit juice.
South of the border the government has earmarked an extra £240m to subsidise healthy ingredients until 2011, while school cooks are to receive extra training.
Ministers in Scotland hope their measures will encourage children to take the healthier meals on offer in school canteens.
Poverty and deprivation
Shona Robison MSP, the Scottish National Party's health spokeswoman, said improving children's diet was a priority for her party.
She said: "Mr McConnell's administration has failed to tackle the fundamental causes of poor diet - poverty and deprivation.
"We will also increase the availability of free nutritious school meals to all children living in poverty and will provide free fruit for all primary school children."
Campaigners said they were disappointed that the executive had not put forward plans to provide all school meals free of charge.