You can not use this code twice, since it’s declaring a function, and declaring a function twice with the same name will trigger a fatal error. If you want to extend the function, you can use it this way:
if(!(in_category('7') OR in_category('8') OR in_category('9'))) return $content;
This will show the ads on these 3 categories.