More than 400 Scottish students have been caught using artificial intelligence to cheat over the past two years.