Set out the terms before you cowrite. That it's not a song until you approve the music. And even after that, you can give the lyrics to someone else. Worst case, if you make money on the new version you may be required to keep the original writer as a 50% partner with you and the new composer splitting the other 50%. But you're hardly ever going to make any money, so it's not a real big concern.