99% of rapper freestyles are writtens, dawg. It's always easy to tell when they're going off the top of the dome because the raps are way more basic, less coherent, and lines tend to bleed into each other. But when you hear a really dope freestyle, it's usually written. Hell back in the 90s when there wasn't internet guys would go on the radio and spit whole verses from their upcoming albums. I've heard Mobb Deep rap all of Trife Life on Stretch & Bobbito and Nas rap the first Memory Lane verse, for example. Big L wouldn't spit whole verses from songs, but a lot of lines from them would get in there.
And Jay never said he freestyles, he just writes and edits it in his head and commits it to memory. Actually fairly simple and I do it a lot when I have to present stuff.