Under Freedom of Information legislation, all health boards were asked how much they had spent on private healthcare, excluding care homes and hospices, since 2009.

NHS Lothian admitted it would have to spend £10m clearing a backlog of patients after it emerged it had been manipulating its waiting time figures in order to meet Scottish government targets.

NHS Grampian consistently denied any wrongdoing but its spending on private healthcare increased as closer scrutiny was given to the way health boards were meeting government targets.

Last year its spending nearly tripled to £6.3m. NHS Grampian has the highest number of patients marked down as "unavailable" for treatment out of all 14 Scottish health boards.

Health boards are allowed to stop the waiting time "clock" if patients say they are unavailable, but the number of unavailable patients in Grampian is seven times higher than the average for mainland health boards.

Unavailability codes

An investigation by Audit Scotland in February found that on two occasions, hundreds of patients were marked as "unavailable" within an hour, and hundreds of others had four or more periods of "unavailability" during their wait for treatment.

I believe we are going to keep it [private sector spending] to an absolute minimumAlex Neil , Health Secretary

In a statement, NHS Grampian said the increase in spending on private healthcare last year was "to meet the specialist needs of patients, for example for complex services that are not available in Grampian e.g. specialist mental health services - and to ensure that patients are seen within the treatment time guarantee targets introduced in 2012/2013".

It added: "We understand that waiting times are important to patients and that most patients prefer to be treated as close to home as possible.

"The NHS Grampian Board recently agreed a £16m investment programme that will increase capacity by building new theatres and employing more doctors, nurses and support staff. The additional local capacity will be available in 2014."

NHS Grampian initially refused to provide the BBC with the amount it had spent on private healthcare in 2012/13 but eventually released the figure after BBC Scotland appealed.

NHS Lothian director of finance Susan Goldsmith said: "We have been clear about our commitment to reduce the number of patients on our waiting lists as quickly as possible.

"As a result of the increased demand this has put on our services, we have invested significantly in providing capacity within the independent sector.

"Our initial estimates on how much this would cost were revised once we had a full understanding of the mix of cases and specialities that could be accommodated within the private sector."

When the SNP came to power in 2007 it declared an intention to clamp down on spending on the private sector.

However, most health boards have continued to buy some services from the private sector.

Treatment guarantees

Speaking on BBC Radio Scotland's Good Morning Scotland programme, Health Secretary Alex Neil said: "Let's get this in perspective, we are talking about half a percent of the entire NHS budget in Scotland."

He insisted that the "short term" use of the independent sector was a "temporary phenomenon".

Mr Neil added: "The answer is we invest in more capacity and we are doing that, particularly in Grampian and Lothian. For example we are currently spending an additional £16m. There are capacity issues in Grampian around orthopaedic and ophthalmic services - we are now investing substantially in additional capacity.

"I have made it absolutely clear to the chairs and chief executive of the 14 territorial health boards in Scotland that the use of the independent sector should only be a last resort because we have huge capacity in Scotland.

Asked if spending on the independent sector was going to increase, Mr Neil added: "I believe we are going to keep it to an absolute minimum."

Private care spend includes specialist care such as fertility treatment and rehab for drug and alcohol addiction.

The amount varies from about £200,000 a year for the smallest health boards including NHS Shetland and NHS Western Isles, to about £3m a year for mainland health boards including Lanarkshire and Fife.