James Aitken, formerly involved in overseas development, said "sleepers" may have been placed "ready to be activated as required".
Scotland would be at a "considerable disadvantage" in the negotiations that would follow a Yes vote, Mr Aitken wrote in The Scottish Review.
Scottish negotiators with little international experience other than fish talks and a few trade missions would face a "formidable" team ready to secure the best deal for the remainder of the UK, he said.
The UK may also get help from US intelligence agents keen to safeguard the UK nuclear deterrent, he said, while the best Scottish negotiators could hope for is a few "spilled beans" from Whitehall.
Mr Aitken managed British aid programmes to a number of developing countries including Kenya, Uganda and India during his time at Whitehall.
He said: "It's a fair bet that any paper produced on independence by St Andrew's House will be circulating in Whitehall's red boxes within 24 hours, along with reports on discussions in private office and ministerial exchanges.
"Sigint (signal intelligence) can provide access to the computer system while Humint (human intelligence) will fill in the gaps.
"It would be surprising if 'sleepers' have not been embedded in St Andrew's House and Victoria Quay, ready to be activated as required."
He added: "The US has made it plain in the past that a nuclear-armed UK is in US interests.
"It follows that any threat to the UK deterrent is a threat to the US and our security services can look to support from US agencies even in activities which might be considered dubious under UK law."
Scottish Secretary Michael Moore has said Scotland would enter post-independence negotiations from "a position of weakness", in contrast to the diminished but still "comparatively large, wealthy and powerful" UK.
Deputy First Minister Nicola Sturgeon has predicted everyone will rally round in the event of independence to secure the best deal for "Team Scotland", regardless of their current political position.
Mr Aitken said: "Whitehall has a significant pool of civil servants who have experience of international negotiation both with governments and in international organisations like the UN and the EU.
"This includes both staff in the Foreign Office and Whitehall home departments where the latter's experience of EU committees will give them a particular advantage.
"The sheer number of staff with relevant experience means that Whitehall will be able to staff and service a large number of committees with people who have already honed their skills in the international arena."
He added: "Coupled with the institutional memory of the home departments, this provides a formidable negotiating structure, with the capacity to cover a large-scale negotiation in depth.
"By comparison, because of the nature of its current remit, the Scottish Government is unlikely to have many staff with direct experience of international negotiations.
"Some will have participated in EU fisheries negotiations, others may have some experience through trade organisations or Scotland's overseas aid programme but there does not appear to be a similar breath of experience to that held by Whitehall."
He said the Scottish Government "may not have sufficient suitably experienced staff to service the negotiations, let alone reach a settlement which is in Scotland's interests".
He added: "The best the Scottish Government can hope for is probably a few spilled beans from Whitehall, or possibly some hints from well-placed people who feel Scotland is getting a bad deal."
Scottish Liberal Democrat leader Willie Rennie said: "This former civil servant rightly points out that an independent Scotland would enter negotiations with a lot to lose from our long relationship with the United Kingdom.
"Whilst the concept of 'sleeper agents' embedded within St Andrews House is all a bit too Ian Fleming (creator of fictional spy James Bond), in any event, given that the nationalists have little clue as to what their independence plans are, they would be tasked with mission impossible."
A Scottish Government spokeswoman said: "These claims are fanciful, to say the least.
"Scottish Government civil servants are working to support Scottish ministers in developing policy for an independent Scotland, and will continue to do so in the run-up to next year's referendum. Doing so is entirely consistent with the Civil Service Code, which applies to the work of all civil servants."