Storing the result of RESTORE FILELISTONLY in a temporary table called #filepaths. 

```
IF object_id('sp_restore') IS NOT NULL
    drop procedure sp_restore
    go

CREATE PROCEDURE sp_restore AS
BEGIN
    RESTORE FILELISTONLY FROM DISK = 'Z:\BACKUPS\my_database_backup.bak'
END
GO

insert into #filepaths 
exec sp_restore

```

How can I get 'Z:\BACKUPS\my\_database\_backup.bak' into a variable? So that the script looks similar to this.

```
DECLARE @BACKUP_PATH as nvarchar(max) = 'Z:\BACKUPS\my_database_backup.bak'

IF object_id('sp_restore') IS NOT NULL
    drop procedure sp_restore
    go

CREATE PROCEDURE sp_restore AS
BEGIN
    RESTORE FILELISTONLY FROM DISK = @BACKUP_PATH
END
GO

insert into #filepaths 
exec sp_restore

```

Thanks,
Craig