It's pretty simple. Just bring Smeargle into battle and use Sketch after your target has used one move (if you move first and use Sketch it will do nothing). Smeargle will permanently learn the last move your target used. That move will replace Sketch. For example:
- You are leading with a Flabebe and you are up against a wild Roselia.
- You switch to Smeargle. Roselia uses Poison Power.
- You use Sketch, and you move before Roselia. Since the last move Roselia used was Poison Power, Smeargle will sketch Poison Power and will learn it permanently.
Notice how I said target up above; in a double or triple battle, you can have Smeargle target a teammate and learn the last move they used. This can allow you to choose what moves Smeargle learns with Sketch.