When Quicksmith Spy enters the battlefield, target artifact you control gains "{T}: Draw a card" for as long as you control Quicksmith Spy.
If Quicksmith Spy leaves the battlefield while its ability is on the stack, the artifact never gains the card-drawing ability.
If Quicksmith Spy leaves the battlefield, you no longer control it.
If Quicksmith Spy or the artifact leaves the battlefield while the card-drawing ability is on the stack, that ability resolves as normal.
If another player gains control of Quicksmith Spy, the artifact will no longer have the card-drawing ability, even if you regain control of Quicksmith Spy.