The AI companies claim that training is fair use, so no license can prevent what is happening with AIs. It would require a clarification in copyright law that AI models are considered derivative works, and that AI generated code is a derivative work of the model and the prompt. That seems unlikely to ever happen though.