My friend has Pokemon x/y and I asked him if he can activate the code and get the genesects then transfer it to me on sun and Moon . Will that work ? Thanks
Unless the Genesect is holding an item or has been modified illegitimately, it should go through without any problems, assumig the same PokeBank restrictions will apply when the Gen VII update happens in January 2017.
Hope I helped. :)
Source: http://bulbapedia.bulbagarden.net/wiki/Pokémon_Bank#Restrictions + Experience