(This is an edited earlier answer of mine to a similar question which I've extended to include Rosucrucianism and secret codes).
There is no evidence to associate the Templars with any of these things. Recently one of the leading historians of the Templars, Helen Nicholson, summed them up thusly: "As far as the Templars went... [the] evidence we’ve got shows them to be extremely boring Roman Catholics".
The stories that the Order uncovered some hidden treasure in Palestine, whether the Holy Grail or otherwise, are baseless. The major relics discovered in the East during the crusades, the Holy Lance and the True Cross, were in no way linked with the Templars. The Lance was discovered in Antioch during the First Crusade, several years before the Templars were formed, whilst the True Cross was had resided in a church in Jerusalem long before the crusades even began. Another strike against this claim is that there was little or no value to keeping a relic secret. Relics were massive attractions for pilgrims and could greatly improve the morale of a medieval Christian army. If the Templars had really found the Grail, you can be sure they would have either put it on display in Jerusalem and charged visitors, or have used it to bless their soldiers before battle. Finally, if they did have such great hidden wealth, then why didn't the Order use it towards fighting in the Holy Land? There's no record of such a massive influx of funds to the Templars that the discovery of hidden treasure would suggest.
As to their supposed link to Freemasonry, this was actually created by the masons themselves in the eighteenth century in an attempt to create a more interesting origin for their fraternities. One source often put forward as evidence of a link between Masons and Templars is the Charter of Transmission. This document was supposedly written by Jean Marc Larmenius in the early fourteenth century, after the Order's suppression in 1312. But was actually written around 1804 for Bernard-Raymond Fabré-Palaprat, the founder of a revived Templar Order. The charter lists grandmasters from the last historical master Jacques de Molay to Fabré-Palaprat. The document's Latin is anachronistic and doesn't match fourteenth century ecclesiastical Latin.
Again there is nothing to link the Templars with Rosicrucianism. It is difficult to fully disprove such theories, perhaps explaining why they continue to survive. But the idea that the Templars could survive in complete secret after 1312 until the first record of Rosicrucianism centuries later in the early modern period is incredibly implausible. There is just no evidence to back it up.
What really happened to the Templars after their dissolution in 1312 was much more mundane. Some of their number had been executed over the course of the trial, or would be executed after like Jacques de Molay. Most of the brethren were sent to join or be looked after by other religious orders. In England in 1338 the Hospitallers were still caring for twelve former Templars. Many brethren in eastern Europe and Germany had never been arrested in the first place and so simply faded from public life. There is no evidence of the Order secretly fleeing to Scotland and becoming Freemasons there, as some pseudohistories claim.
No secret code associated with the Templars has been discovered either. Sites with supposed hidden meanings like Rosslyn Chapel were built long after the Templars and have no link to the Order (one ancestor of the Rosslyn's builder actually testified against the Scottish Templars at their trial in 1309).
Another summary of this issue by Nicholson is that "Modern 'discoveries' about the Templars are really a form of fantasy writing, with less basis in actual historical events than most historical novels."
Sources:
Malcolm Barber, The New Knighthood (Cambridge, 1994).
Alan H. Hooker, 'The Knights Templar - Fact & Fantasy', Ars Quatuor Coronatorum: Transactions of the Quatuor Coronati Lodge No. 2076, Vol 96 (1984), pp. 204-11.
Lambert B. Larking and John M. Kemble, The Knights Hospitallers in England: Being the Report of Prior Philip de Thame to the Grand Master Elyan de Villanove, for 1338 (London, 1857).
Helen Nicholson, The Knights Templar (Sutton, 2001).
John Walker, ''The Templars are Everywhere': An Examination of the Myths Behind Templar Survival after 1307', in Jochen Burgtorf, Paul Crawford, and Helen Nicholson (eds), The Debate on the Trial of the Templars, 1307-1314 (Farnham, 2010), pp. 347-358.