SPOILER warning. If you haven't read the recently released Fire & Blood book by George R. R. Martin, or haven't seen the last episode of season 7, then this post contains possible spoilers.
In the book Fire & Blood, when Queen Alysanne, married to the Old King Jaehaerys, visited the Wall and tried to cross it on her dragon Silverwing, she refused to take her beyond the Wall. Here's an excerpt from the book which describes the incident:
“Thrice I flew Silverwing high above Castle Black, and thrice I tried to take her north beyond the Wall, but every time she veered back south again and refused to go. Never before has she refused to take me where I wished to go. I laughed about it when I came down again, so the black brothers would not realize anything was amiss, but it troubled me then and it troubles me still.”
Fire & Blood, "Jaehaerys and Alysanne - Their Triumphs and Tragedies"
From the ASOIAF books, we know that the Wall is not just a high ice wall but it also has its own magic (spells and whatnot) which is why the dead cannot cross it. Probably the magic works both ways and dragons being the magical creatures, cannot cross it, or wouldn't cross it, just a theory.
That bring us to the last episode of season 7. As we know Danaerys' dragons crossed the Wall to save Jon Snow and his companions. The dragons maybe smarter than your average beasts but I don't think they shared any knowledge down the generations of Targaryen dragons which would explain why Silverwing didn't cross the Wall but Drogon and other dragons did because they weren't brought up on Dragonstone or the pit.
So why would the dragon Silverwing not cross the Wall?