The Scottish Prison Service has confirmed it will apply for permission to exhume the bodies of convicted killers hanged at Barlinnie Prison.
The Victorian jail in Glasgow is due to be demolished in 2025.
It is not known how many bodies are buried at Barlinnie - but they include Glasgow serial killer Peter Manuel, who was executed in 1958.
The prison service said if relatives could be contacted, bodies could either be reburied or the remains cremated.
If no relatives can be found, the remains will be cremated.
Executed for murder
Barlinnie, built in 1882, is Scotland's largest prison and has held as many as 1,500 men.
It will be replaced by a new jail, HMP Glasgow, which is expected to be completed by 2023 on a site at Provanmill about a mile away.
The Scottish Prison Service (SPS) says it is not known how many bodies are buried at Barlinnie, but there were 10 executions there between 1946 and 1960.
The last hanging took place in the execution suite in 1960, when 19-year-old Anthony Miller was executed for murder during a robbery which went wrong.
Two years earlier Peter Manuel had been hanged after being convicted of nine murders - although it is thought he may have killed at least nine other people in the west of Scotland.
Tom Fox, a spokesman for SPS, said a sheriff would have to give permission for the bodies to be exhumed.
He said: "A number of bodies were discovered in the prison grounds in the 1970s during pipe-laying work, and they were re-buried elsewhere on the site.
"We would try to find any relatives of the deceased and ask them if they wanted the remains to be buried somewhere else, or cremated."
How were executions carried out in Scotland?
Most prisons in Scotland had an execution suite where prisoners convicted of capital crimes were hanged, often by official executioner Albert Pierrepoint.
The execution suite at Barlinnie was finally demolished in the mid 1990s, but Mr Fox said he had discovered some unusual facts about its use.
He said: "I was given Peter Manuel's file and discovered the Lord Provost paid for executions in Glasgow.
"The block and the rope used in the hangings were sent by train from the Home Office in London and returned there after the execution.
"Hangings usually took place at 08:00 and within an hour the body was in its grave, covered in lime.
"Prison officers then posted a bulletin on the main prison gate."
There were frequently crowds outside prisons when an execution took place, many campaigning against the use of the death penalty.
The last judicial execution carried out in Scotland was at Craiginches Prison, Aberdeen when Henry John Burnett was hanged on 15 August 1963.
He had been convicted three weeks earlier of the murder of merchant seaman Thomas Guyan.
Burnett was the first man to be hanged in a new execution suite in Aberdeen - and was also the last. Executions were paused in Britain in 1964 and finally abolished in 1969.
Burnett's body was exhumed when the Aberdeen prison was demolished and his relatives were informed. It has now been reinterred.
Susan Newell was the last woman to be hanged in Scotland, in 1923.
She died in Duke Street Gaol in Glasgow, having been convicted of the murder of 13-year-old newspaper boy John Johnston.
During redevelopment work at Perth Prison, Scotland's oldest jail, the bodies of several Napoleonic prisoners of war were discovered and reinterred.