Yes, Sai and Yamato are code names. In the anime and I believe manga as well, we even watch both of them get assigned those names by Danzo and Tsunade respectively at around the same time right before they go to meet Naruto for the first time.
Sai was orphaned as a child and recruited into Root, a secret branch of the Anbu under the leadership of Danzō Shimura. There, he was raised and conditioned to have no personality, personal connections, or a name; "Sai" being given to him for the purposes of joining Team Kakashi.
and 3 snippets from http://naruto.wikia.com/wiki/Yamato
He was soon afterwards found by Danzō Shimura. Having lost all memory of who he was, the boy was taken in by Danzō, where he was recruited into the Anbu's Root division under the codename Kinoe (甲, Kinoe)........Later, Kinoe was re-assigned to Team Ro under Kakashi's command. Joining his new squad, Kinoe was given a warm welcome to his new allies and insisted by Kakashi that he go by his chosen name of "Tenzō", which he happily agreed to......... "Yamato" and "Tenzō" are actually codenames given to him, reflecting his time as Team Kakashi's captain and an Anbu member, respectively; his real name is unknown.