I've written words to tunes I'd already done, but it's much harder than the other way around. It could just be me, but it's easier to find a melody that brings out the best in the words than find words to fit a melody. Sometimes, words and tune happen together but that's really rare.