I hate to say this, but the above answers are wrong. I tried this ingame a few months back, and found that Sketch fails when not used by Smeargle used by a transformed Pokémon, even if it's a Ditto transformed as a Smeargle (except in Gen 2, which triggers a glitch which SadisticMystic has covered). Post Gen 2, Ditto can't learn any move through Sketch, not even temporarily.
Edit: Looked it up on Bulbapedia and found that Sketch isn't species-locked like Dark Void, but is rather just set to fail if the user is transformed. Either way, Ditto still can't use it.