The souls of Girvan's genteel deceased stand like sentinels over the sands of what used to be the Ayrshire Riviera's finest shore. Their graveyard is a thing of some beauty with some of its monuments hewn from the granite rock of the Ailsa Craig shimmering 10 miles away across the Firth of Clyde. Even in death, they value their privacy in south Ayrshire and so a 10-foot wall protects their sepulchral modesty from the gaze of beach-front promenaders.

This lovely old necropolis became a refuge for me in the early 1970s when long, hot summers brought thousands of fair fortnight Glaswegians to the coast and turned the sands into a Broons Convention beach party. "Is that jellyfish deid? Can we take it hame wi' us?" and: "Jist pish in the waater when it gets waist high, by the way."

As soon as you walked in by its gated entrance, a silence descended and the stillness was utter and complete. On every stone, there was a tale of love, romance, tragedy and glory. Sadness of course but joy too, and hours could pass imagining the family passions interred beneath. Very quickly, it seemed, it was time for the fish suppers and a walk by the harbour.

Yet while graveyards can pacify the spirit, a kirkyard has an even more profound splendour. It comes, I think, from the presence of a church amid the tombstones which perhaps provides a tangible sign of the spirit's final journey. My favourite kirkyard is the Canongate that lies at the foot of Edinburgh's Royal Mile in the shadow of the Holyrood Parliament.

Within seconds, the thrum of tourists walking towards the Palace of Holyroodhouse disappears and you are looking at a beautiful old graveyard falling away beneath you on three terraces. The silence is only matched by that which descends on an Edinburgh tavern when you ask whose turn it is to buy the next round of drinks.

Overlooking it at one end is Arthur's Seat and at the other is the Calton Hill. Here, you will find the graves of Adam Smith and the great Scots poet Robert Fergusson, mentor of Robert Burns, who died tragically young at 24, cut down in the midst of the very flowering of his genius. It is also thought that here also lies the body of David Rizzio, the secretary and lover of Mary, Queen of Scots, who died in 1566.

The Canongate kirkyard is a jewel in the firmament of Edinburgh's many enchanted spaces and I had cause to be grateful for its ability to restore a flagging spirit when I worked for the Scotsman newspaper, whose HQ was a two-minute walk away.

Is there anything better in the world for a troubled soul than to set himself down on a bench contemplating a row of quiet headstones with a packet of cigarettes and fortified by a few lunchtime Bacardis?

Yet last week it was revealed that, along with another four of the city's grandest cemeteries, it has been placed on the World Monuments Fund's at-risk register owing to creeping neglect over a long number of years. Among the other four is Greyfriars Kirk where slain Covenanters lie and whose bones, from time to time, still rattle and roll beside some startled visitors. There are issues of responsibility for upkeep of gravestones at the root of some of the problems.

For while, the council or the church have a general responsibility for maintaining a yard, it is largely expected that families will look after individual stones. But who looks after graves that are more than 300 years old? The importance of these burial sites to the nation cannot be overestimated. In the words of the Heritage body, they "form a collection of graveyards that provides a window into the history, culture, and society of Scotland from the early 17th to late 19th century".

Edinburgh's city council says it is committed to addressing the problem and will work with campaigners and heritage bodies to return their graveyards to their natural glory. Yet it is puzzling that funds for keeping these sites beautiful are not included in the city's annual budget.

The turf that enfolds the bodies of our dead is hallowed ground and each contains a little piece of our nation's narrative. The memories and experiences that accompany our people as they pass from this life are sacred too. If we allow them to fall into a state of decrepitude we are all reduced.

Robert Burns acknowledged the sanctity of the grave and was heartbroken when he saw how poorly Robert Fergusson had been buried in Canongate Kirkyard. In 1787, three years after his friend's death, he paid for the lovely tombstone that marks the final resting place of the great poet and penned this tribute:

O why should truest Worth and Genius pine

Beneath the iron grasp of Want and Woe

While titled knaves and idiot-greatness shine

In all the splendour Fortune can bestow.

If I am granted the privilege of a decent burial, I'd be happy to leave with the words of the great Birmingham rock-poets Tony Iommi and Geezer Butler whose oeuvre inspired the music of Black Sabbath, echoing in the breeze. Perhaps they were inspired by Burns the great egalitarian when they wrote in 1980: